<?php
use Doctrine\ORM\EntityRepository;

class IM_Admin_user_repo extends EntityRepository{

		
	public function findUser($s_username, $s_password){
		$s_query = 'SELECT a.username, a.password FROM entities\IM_Admin_user a WHERE a.username = ?1 AND a.password= ?2';
		$rs = $this->getEntityManager()->createQuery($s_query);
		$rs->setParameter(1,$s_username);
		$rs->setParameter(2, hash('md5', $s_password));
		$resultSet = $rs->getResult();
		
		return $resultSet;
	}
	
	public function getUsers(){
		$s_query = 'SELECT a FROM entities\IM_Admin_user a';
		$rs = $this->getEntityManager()->createQuery($s_query);
		//$rs->setMaxResults(1);
		$resultSet = $rs->getResult();
		
		return $resultSet;
	}
}